import { CommonModule } from '@angular/common';
import { ModuleWithProviders, NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';

import { NgxImgComponent } from './ngx-img.component';
import { NgxImgCropComponent } from './ngx-img-crop.component';
import { NgxImgService } from './ngx-img.service';

// Export module's public API
export { NgxImgComponent } from './ngx-img.component';
export { NgxImgCropComponent } from './ngx-img-crop.component';
export { NgxImgService } from './ngx-img.service';

@NgModule({
    imports: [CommonModule, FormsModule],
    exports: [NgxImgComponent, NgxImgCropComponent],
    declarations: [NgxImgComponent, NgxImgCropComponent],
    providers: [NgxImgService],
})
export class NgxImgModule {
    static forRoot(): ModuleWithProviders {
        return {
            ngModule: NgxImgModule,
            providers: [NgxImgService],
        };
    }
}
